﻿<%@ Page Language="C#" MasterPageFile="~/SimplePMT.Master" AutoEventWireup="true" CodeBehind="TimeReporting.aspx.cs" Inherits="SimplePMT.TimeReporting" %>
<asp:Content ID="Content1" runat="server" ContentPlaceHolderID="MainContent">
    <form name="testForm">
    <table>
        <tr>
            <td><a href="TimeReporting.aspx?start=<%= PrevStartDate %>&end=<%= PrevEndDate %>"><< Previous</a> &nbsp;&nbsp;From: <%= CalendarInput.Calendar("StartDate", Convert.ToDateTime(StartDate)) %>&nbsp;&nbsp;&nbsp;To:<%= CalendarInput.Calendar("EndDate", Convert.ToDateTime(EndDate)) %>&nbsp;&nbsp;<a href="TimeReporting.aspx?start=<%= NextStartDate %>&end=<%= NextEndDate %>">Next >></a></td>
            <td valign=bottom>&nbsp;&nbsp;<input type="button" value="Get Report" OnClick="reportProject(document.testForm.StartDate.value, document.testForm.EndDate.value, document.testForm.summary.checked);"/>&nbsp;&nbsp;<input type="checkbox" id="summary" name="summary" value="1" OnClick="reportProject(document.testForm.StartDate.value, document.testForm.EndDate.value, this.checked);" /> Hour Summary By Day <span id="loading" style="display:none"><img src="images/loading-tp.gif"></span>
            </td>
        </tr>
    </table>
    <div id="reportContents">
    <%= onLoadReport %>
    </div>
    </form>
    <script>
        function reportProject(fromDate, toDate, summary) {
            document.getElementById('loading').style.display = 'inline';
            $('scrollArea').className = 'loading_overlay';
            SimplePMT.TimeReporting.GetTimeReport(fromDate, toDate, summary, function(response) {
                if (response.error != null) {
                    alert(response.error.Message);
                }
                document.getElementById('reportContents').innerHTML = response.value;
                $('scrollArea').className = '';
                document.getElementById('loading').style.display = 'none';
            });
            
        }
       
    </script>
</asp:Content>